﻿using Dijiang.Errors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dijiang.Values
{
    public class DBoolean : DValue
    {
        public static DBoolean TRUE => new DBoolean(true);
        public static DBoolean FALSE => new DBoolean(false);

        public bool value;

        public DBoolean(bool value)
        {
            this.value = value;
        }

        public DValue Eval(CmdEnv env)
        {
            return this;
        }

        public DValue Copy()
        {
            return new DBoolean(value);
        }

        public override string ToString()
        {
            return value.ToString();
        }

        public bool Equals(DValue? other)
        {
            return other is DBoolean bo && value == bo.value;
        }
    }
}
